package Behavioral.Strategy;

import Behavioral.Strategy.demo2.Cat;
import com.google.common.collect.Lists;
import org.testng.annotations.Test;

import java.util.Collections;
import java.util.List;

public class StrategyJDK {

	@Test
	public void t1() {
		List<Cat> cats = Lists.newArrayList(new Cat(55, 55), new Cat(11, 11), new Cat(33, 33));
		Collections.sort(cats, ((o1, o2) -> {
			if (o1.weight > o2.weight) {
				return 1;
			} else if (o1.weight < o2.weight) {
				return -1;
			} else {
				return 0;
			}
		}));
		System.out.println(cats);
	}
}
